public class twoSum1 {
    public int[] twoSum(int[] price, int target) {
        int left = 0,right = price.length - 1;
        while(left < right) {
            int sum = price[right] + price[left];
            if(sum < target) {
                left++;
            } else if(sum > target) {
                right--;
            } else {
                return new int[] {price[left],price[right]};
            }
        }
        //应付编译器
        return new int[] {0};
    }
}
